home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / Email.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-02-25  |  5.6 KB  |  212 lines

  1. import java.applet.Applet;
  2. import java.awt.Button;
  3. import java.awt.Checkbox;
  4. import java.awt.CheckboxGroup;
  5. import java.awt.Color;
  6. import java.awt.Component;
  7. import java.awt.Container;
  8. import java.awt.Event;
  9. import java.awt.Font;
  10. import java.awt.Label;
  11. import java.awt.LayoutManager;
  12. import java.awt.Panel;
  13. import java.awt.TextArea;
  14. import java.awt.TextField;
  15. import symantec.itools.awt.WrappingLabel;
  16. import symantec.itools.lang.Context;
  17. import symantec.itools.util.Timer;
  18.  
  19. public class Email extends Applet {
  20.    Label label1;
  21.    TextField textField1;
  22.    Label label2;
  23.    TextField textField2;
  24.    Label label3;
  25.    TextField textField3;
  26.    Label label4;
  27.    TextField textField4;
  28.    Label label5;
  29.    TextField textField5;
  30.    Label label6;
  31.    TextField textField6;
  32.    Label label7;
  33.    TextField textField7;
  34.    Label label8;
  35.    TextField textField8;
  36.    Label label9;
  37.    TextField textField9;
  38.    Label label10;
  39.    Checkbox radioButton1;
  40.    CheckboxGroup Group1;
  41.    Checkbox radioButton2;
  42.    Checkbox radioButton3;
  43.    Label label11;
  44.    TextArea textArea1;
  45.    Label label12;
  46.    TextArea textArea2;
  47.    Button button1;
  48.    Button button2;
  49.    WrappingLabel wrappingLabel1;
  50.    Timer timer1;
  51.  
  52.    void Email_GotFocus(Event event) {
  53.       this.textField7.setText("");
  54.    }
  55.  
  56.    void timer1_TimerEvent(Event event) {
  57.       this.wrappingLabel1.hide();
  58.       this.textField1.setText("");
  59.       this.textField2.setText("");
  60.       this.textField3.setText("");
  61.       this.textField4.setText("");
  62.       this.textField5.setText("");
  63.       this.textField6.setText("");
  64.       this.textField7.setText("");
  65.       this.textField8.setText("");
  66.       this.textField9.setText("");
  67.       this.textArea1.setText("");
  68.       this.textArea2.setText("");
  69.       this.radioButton1.setState(true);
  70.    }
  71.  
  72.    void button2_Clicked(Event event) {
  73.       this.timer1.start();
  74.       this.wrappingLabel1.show();
  75.    }
  76.  
  77.    void button1_Clicked(Event event) {
  78.       this.textField1.setText("");
  79.       this.textField2.setText("");
  80.       this.textField3.setText("");
  81.       this.textField4.setText("");
  82.       this.textField5.setText("");
  83.       this.textField6.setText("");
  84.       this.textField7.setText("");
  85.       this.textField8.setText("");
  86.       this.textField9.setText("");
  87.       this.textArea1.setText("");
  88.       this.textArea2.setText("");
  89.       this.radioButton1.setState(true);
  90.    }
  91.  
  92.    public void init() {
  93.       super.init();
  94.       Context.setDocumentBase(((Applet)this).getDocumentBase());
  95.       ((Container)this).setLayout((LayoutManager)null);
  96.       ((Panel)this).addNotify();
  97.       ((Applet)this).resize(503, 585);
  98.       ((Component)this).setFont(new Font("Dialog", 1, 12));
  99.       ((Component)this).setForeground(new Color(0));
  100.       ((Component)this).setBackground(new Color(16777215));
  101.       this.label1 = new Label("Name");
  102.       this.label1.reshape(0, 8, 120, 28);
  103.       ((Container)this).add(this.label1);
  104.       this.textField1 = new TextField();
  105.       this.textField1.reshape(128, 8, 349, 30);
  106.       ((Container)this).add(this.textField1);
  107.       this.label2 = new Label("Address");
  108.       this.label2.reshape(0, 48, 120, 28);
  109.       ((Container)this).add(this.label2);
  110.       this.textField2 = new TextField();
  111.       this.textField2.reshape(128, 48, 349, 30);
  112.       ((Container)this).add(this.textField2);
  113.       this.label3 = new Label("City/Town");
  114.       this.label3.reshape(0, 88, 120, 28);
  115.       ((Container)this).add(this.label3);
  116.       this.textField3 = new TextField();
  117.       this.textField3.reshape(128, 88, 349, 30);
  118.       ((Container)this).add(this.textField3);
  119.       this.label4 = new Label("State/County");
  120.       this.label4.reshape(0, 128, 120, 28);
  121.       ((Container)this).add(this.label4);
  122.       this.textField4 = new TextField();
  123.       this.textField4.reshape(128, 128, 349, 30);
  124.       ((Container)this).add(this.textField4);
  125.       this.label5 = new Label("Country Code");
  126.       this.label5.reshape(0, 168, 120, 28);
  127.       ((Container)this).add(this.label5);
  128.       this.textField5 = new TextField();
  129.       this.textField5.reshape(128, 168, 349, 30);
  130.       ((Container)this).add(this.textField5);
  131.       this.label6 = new Label("Zip Code/Postcode");
  132.       this.label6.reshape(0, 208, 128, 28);
  133.       ((Container)this).add(this.label6);
  134.       this.textField6 = new TextField();
  135.       this.textField6.reshape(128, 208, 349, 30);
  136.       ((Container)this).add(this.textField6);
  137.       this.label7 = new Label("Telephone");
  138.       this.label7.reshape(0, 248, 120, 28);
  139.       ((Container)this).add(this.label7);
  140.       this.textField7 = new TextField();
  141.       this.textField7.reshape(128, 248, 349, 30);
  142.       ((Container)this).add(this.textField7);
  143.       this.label8 = new Label("Fax");
  144.       this.label8.reshape(0, 288, 120, 28);
  145.       ((Container)this).add(this.label8);
  146.       this.textField8 = new TextField();
  147.       this.textField8.reshape(128, 288, 349, 30);
  148.       ((Container)this).add(this.textField8);
  149.       this.label9 = new Label("E-mail");
  150.       this.label9.reshape(0, 328, 120, 28);
  151.       ((Container)this).add(this.label9);
  152.       this.textField9 = new TextField();
  153.       this.textField9.reshape(128, 328, 349, 30);
  154.       ((Container)this).add(this.textField9);
  155.       this.label10 = new Label("What types of tours are you interested in?");
  156.       this.label10.reshape(0, 368, 476, 35);
  157.       ((Container)this).add(this.label10);
  158.       this.Group1 = new CheckboxGroup();
  159.       this.radioButton1 = new Checkbox("Custom", this.Group1, false);
  160.       this.radioButton1.reshape(16, 400, 88, 32);
  161.       ((Container)this).add(this.radioButton1);
  162.       this.radioButton2 = new Checkbox("Package", this.Group1, false);
  163.       this.radioButton2.reshape(120, 400, 88, 32);
  164.       ((Container)this).add(this.radioButton2);
  165.       this.radioButton3 = new Checkbox("Both", this.Group1, false);
  166.       this.radioButton3.reshape(224, 400, 88, 32);
  167.       ((Container)this).add(this.radioButton3);
  168.       this.label11 = new Label("How did you find out about us?");
  169.       this.label11.reshape(0, 432, 476, 27);
  170.       ((Container)this).add(this.label11);
  171.       this.textArea1 = new TextArea();
  172.       this.textArea1.reshape(16, 464, 469, 64);
  173.       ((Container)this).add(this.textArea1);
  174.       this.label12 = new Label("Do you have any other comments?");
  175.       this.label12.reshape(0, 536, 476, 26);
  176.       ((Container)this).add(this.label12);
  177.       this.textArea2 = new TextArea();
  178.       this.textArea2.reshape(16, 568, 469, 64);
  179.       ((Container)this).add(this.textArea2);
  180.       this.button1 = new Button("Clear");
  181.       this.button1.reshape(144, 648, 102, 31);
  182.       ((Container)this).add(this.button1);
  183.       this.button2 = new Button("Submit Request");
  184.       this.button2.reshape(256, 648, 102, 31);
  185.       ((Container)this).add(this.button2);
  186.       this.wrappingLabel1 = new WrappingLabel();
  187.       this.wrappingLabel1.hide();
  188.       this.wrappingLabel1.reshape(160, 688, 184, 40);
  189.       this.wrappingLabel1.setFont(new Font("Dialog", 1, 14));
  190.       ((Container)this).add(this.wrappingLabel1);
  191.       this.wrappingLabel1.setAlignStyle(1);
  192.       this.wrappingLabel1.setText("Submitting request... (Simulated)");
  193.       this.timer1 = new Timer(this, 3000, false);
  194.       this.timer1.start();
  195.    }
  196.  
  197.    public boolean handleEvent(Event event) {
  198.       if (event.target == this.button1 && event.id == 1001) {
  199.          this.button1_Clicked(event);
  200.          return true;
  201.       } else if (event.target == this.button2 && event.id == 1001) {
  202.          this.button2_Clicked(event);
  203.          return true;
  204.       } else if (event.target == this.timer1 && event.id == 1001) {
  205.          this.timer1_TimerEvent(event);
  206.          return true;
  207.       } else {
  208.          return super.handleEvent(event);
  209.       }
  210.    }
  211. }
  212.